﻿<ResourceDictionary
 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:theme="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero" 
    >
    <Style  TargetType="{x:Type DataGridColumnHeader}">
        <Setter  Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type DataGridColumnHeader}">
                    <ControlTemplate.Resources>
                        <Storyboard   x:Key="ShowFilterControl">
                            <ObjectAnimationUsingKeyFrames x:Uid="ObjectAnimationUsingKeyFrames_1" BeginTime="00:00:00" Storyboard.TargetName="filterTextBox" 
                                                           Storyboard.TargetProperty="(UIElement.Visibility)">
                                <DiscreteObjectKeyFrame x:Uid="DiscreteObjectKeyFrame_1" KeyTime="00:00:00" Value="{x:Static Visibility.Visible}"/>
                                <DiscreteObjectKeyFrame x:Uid="DiscreteObjectKeyFrame_2" KeyTime="00:00:00.5000000" Value="{x:Static Visibility.Visible}"/>
                            </ObjectAnimationUsingKeyFrames>
                            <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="filterTextBox" 
                                                          Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)">
                                <SplineColorKeyFrame  KeyTime="00:00:00" Value="Transparent"/>
                                <SplineColorKeyFrame  KeyTime="00:00:00.5000000" Value="White"/>
                            </ColorAnimationUsingKeyFrames>
                        </Storyboard>
                        <Storyboard  x:Key="HideFilterControl">
                            <ObjectAnimationUsingKeyFrames x:Uid="ObjectAnimationUsingKeyFrames_2" BeginTime="00:00:00" Storyboard.TargetName="filterTextBox"
                                                           Storyboard.TargetProperty="(UIElement.Visibility)">
                                <DiscreteObjectKeyFrame x:Uid="DiscreteObjectKeyFrame_3" KeyTime="00:00:00.4000000" Value="{x:Static Visibility.Collapsed}"/>
                            </ObjectAnimationUsingKeyFrames>
                            <ColorAnimationUsingKeyFrames x:Uid="ColorAnimationUsingKeyFrames_2" BeginTime="00:00:00" Storyboard.TargetName="filterTextBox" 
                                                          Storyboard.TargetProperty="(UIElement.OpacityMask).(SolidColorBrush.Color)">
                                <SplineColorKeyFrame x:Uid="SplineColorKeyFrame_3" KeyTime="00:00:00" Value="Black"/>
                                <SplineColorKeyFrame x:Uid="SplineColorKeyFrame_4" KeyTime="00:00:00.4000000" Value="#00000000"/>
                            </ColorAnimationUsingKeyFrames>
                        </Storyboard>
                    </ControlTemplate.Resources>
                    <ControlTemplate.Triggers>
                        <Trigger   Property="IsMouseOver" Value="True">
                            <Trigger.EnterActions>
                                <BeginStoryboard   x:Name="ShowFilterControl_BeginStoryboard" Storyboard="{StaticResource ShowFilterControl}"/>
                                <StopStoryboard  BeginStoryboardName="HideFilterControl_BeginShowFilterControl"/>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard  x:Name="HideFilterControl_BeginShowFilterControl" Storyboard="{StaticResource HideFilterControl}"/>
                                <StopStoryboard BeginStoryboardName="ShowFilterControl_BeginStoryboard"/>
                            </Trigger.ExitActions>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>
